package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacJournalsType;
import com.ruoyi.school.domain.PacReslutLevel;
import com.ruoyi.school.service.PacJournalsTypeService;
import com.ruoyi.system.service.impl.ReslutLevelServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/school/journalsType")
public class PacJournalsTypeController extends BaseController {
    @Resource
    private PacJournalsTypeService pacJournalsTypeService;

    @ApiOperation("论文期刊列表")
    @GetMapping("/list")
    public TableDataInfo list(PacJournalsType rereslutLevel) {
        startPage();
        List<PacJournalsType> list = pacJournalsTypeService.getList(rereslutLevel);
        return getDataTable(list);
    }

    @GetMapping("/details")
    public AjaxResult details(PacJournalsType rereslutLevel) {
        PacJournalsType details = pacJournalsTypeService.getDetails(rereslutLevel);
        return success(details);
    }

    @Log(title = "论文期刊", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PacJournalsType rereslutLevel) {
        boolean add = pacJournalsTypeService.add(rereslutLevel);
        return success(add);
    }

    @Log(title = "论文期刊", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult update(@RequestBody PacJournalsType rereslutLevel) {
        boolean update = pacJournalsTypeService.edit(rereslutLevel);
        return success(update);
    }

    @Log(title = "论文期刊", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(PacJournalsType rereslutLevel) {
        boolean delete = pacJournalsTypeService.delete(rereslutLevel);
        return success(delete);
    }

    @GetMapping("/all")
    public AjaxResult all(PacJournalsType rereslutLevel) {
        List<PacJournalsType> list = pacJournalsTypeService.getAllList(rereslutLevel);
        return success(list);
    }
}
